home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pinstaller / tests / parttest.py < prev    next >
Text File  |  2005-04-11  |  1KB  |  38 lines

  1. #!/usr/bin/python
  2.  
  3. import parted, sys
  4.  
  5. if len(sys.argv) <= 1:
  6.     print "You must call this script with a device name"
  7.     sys.exit(1)
  8.  
  9. parted_dev = parted.PedDevice.get(sys.argv[1])
  10. parted_disk = parted.PedDisk.new(parted_dev)
  11. print "Device: " + sys.argv[1]
  12. print "Disklabel: " + parted_disk.type.name
  13. print "Length (sectors): " + str(parted_dev.length)
  14. partition = parted_disk.next_partition()
  15. while partition:
  16.     print "--------------------"
  17.     print "Minor: " + str(partition.num)
  18.     print "Type: " + str(partition.type)
  19.     print "Type name: " + partition.type_name
  20.     try:
  21.         print "Start: " + str(partition.geom.start)
  22.         print "End: " + str(partition.geom.end)
  23.         print "FS type: " + partition.fs_type.name
  24.     except:
  25.         pass
  26.     if partition.num > 0:
  27.         print "Flags:"
  28.         for flag in range(1, 10):
  29.             if partition.is_flag_available(flag):
  30.                 if partition.get_flag(flag):
  31.                     print "\t" + str(flag) + " - ON"
  32.                 else:
  33.                     print "\t" + str(flag) + " - OFF"
  34.             else:
  35.                 print "\t" + str(flag) + " - N/A"
  36. #        print "System: " + str(partition.get_system())
  37.     partition = parted_disk.next_partition(partition)
  38.